package net.zjitc.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

import static java.lang.System.out;

/**
 * Created by Administrator on 2017/9/25.
 */
@WebServlet(name = "HttpServlet",urlPatterns="/hservlet")
public class HttpServlet extends javax.servlet.http.HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       //设置相应的编码方式
      response.setContentType("text/html;charset=utf-8");
       //设置三秒后自动跳转
       // response.setHeader("refresh","3;http://www.zjitc.net");
        //刷新当前页面
      /* response.setHeader("refresh","3");*/
       //PrintWriter out=response.getWriter();
       //重定向到登录页面
        //response.sendRedirect("/web/gServlet");
        response.sendRedirect("login/login.jsp");
       /*out.write("嘻嘻嘻嘻嘻嘻....");
       out.write("嘻嘻http");*/


    }
}
